<?php


namespace App\Http\Controllers\admin\validate;


use Illuminate\Support\Facades\Validator;

class Sn
{
    public static function importSnBatch($param){
        $rules = [
            'userId'=>'required|numeric',
            'batch_id'=>'required|numeric',
            'lastIp'=>'required|ip',
            'file'=>'required|file'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'batch_id.required'=>'班级为空',
            'batch_id.numeric'=>'班级格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'file.required'=>'文件为空',
            'file.file'=>'不是文件',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function importSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'file'=>'required|file'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'file.required'=>'文件为空',
            'file.file'=>'不是文件',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addAdminSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'snValue'=>'required|between:11,13'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'snValue.required'=>'sn码为空',
            'snValue.between'=>'sn码小于或大于12位',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function singleDeviceRestartOrRecovery($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'sn'=>'required'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'sn.required'=>'设备码为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAdminSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteAdminSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function onEmpower($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function onBindSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function importUpdateSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'file'=>'required|file'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'班级名称为空',
            'file.required'=>'文件为空',
            'file.file'=>'不是文件格式',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryBatch($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdBatch($param){
        $rules = [
            'id'=>'required|numeric'
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addBatch($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'班级名称为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editBatch($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'name'=>'required',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'name.required'=>'班级名称为空',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteBatch($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function querySnHardware($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function cleanInstallAppCache($param){
        $rules = [
            'id'=>'required',
        ];
        $msg = [
            'id.required'=>'编号为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function renovate($param){
        $rules = [
            'sn'=>'required|between:11,13',
        ];
        $msg = [
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function uninstallApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'sn'=>'required|between:11,13',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function forceStopApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'sn'=>'required|between:11,13',
            'id'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',            
            'sn.required'=>'sn码为空',
            'sn.between'=>'sn码长度不正确',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function sendScreenshot($param){
        $rules = [
            'id'=>'required|numeric',
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip'
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryScreenshot($param){
        $rules = [
            'id'=>'required|numeric'
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteScreenshot($param){
        $rules = [
            'id'=>'required|numeric'
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addParentTimeControl($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'lastIp'=>'required|ip',
            'startTime'=>'required',
            'endTime'=>'required'
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'startTime.required'=>'开始时间为空',
            'endTime.required'=>'结束时间为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addTeacherTimeControl($param){
        $rules = [
            'userId'=>'required|numeric',
            'bId'=>'required',
            'lastIp'=>'required|ip',
            'startTime'=>'required',
            'endTime'=>'required'
        ];
        $msg = [
            'bId.required'=>'班级编号为空',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'startTime.required'=>'开始时间为空',
            'endTime.required'=>'结束时间为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryTimeControl($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'startSize'=>'required|numeric',
            'pageSize'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'startSize.required'=>'当前页为空',
            'startSize.numeric'=>'当前页格式不对',
            'pageSize.required'=>'页面显示数为空',
            'pageSize.numeric'=>'页面显示数格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdTimeControl($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function updateTimeControl($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'lastIp'=>'required|ip',
            'startTime'=>'required',
            'endTime'=>'required'
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'startTime.required'=>'开始时间为空',
            'endTime.required'=>'结束时间为空'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteTimeControl($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'lastIp'=>'required|ip',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdBatchList($param){
        $rules = [
            'userId'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editTeacherSn($param){
        $rules = [
            'userId'=>'required|numeric',
            'id'=>'required|numeric',
            'batch_id'=>'required|numeric',
            'lastIp'=>'required|ip',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'batch_id.required'=>'班级为空',
            'batch_id.numeric'=>'班级格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

}